Quant Exam  >  Quant Questions  >  What is the output of the following programma... Start Learning for Free
What is the output of the following program
main()
{
int a=10;
int b=6;
if(a=3)
b++;
printf("%d %dn",a,b++);
}
  • a)
    10,6 
  • b)
    10,7 
  • c)
    3,6 
  • d)
    3,7 
  • e)
    none
Correct answer is option 'D'. Can you explain this answer?
Most Upvoted Answer
What is the output of the following programmain(){int a=10;int b=6;if(...
Here 'a' is assigned with value of 3. to check we just need to compare '==' instead '='.
Free Test
Community Answer
What is the output of the following programmain(){int a=10;int b=6;if(...
There is a syntax error in the program as the printf statement is incomplete. The correct program should be:

#include

int main(){
int a = 10;
int b = 6;
if(a = 3)
b;
printf("%d", b);
return 0;
}

The output of this program is 6, as the if statement assigns the value 3 to variable a (due to the single equals sign used for assignment instead of comparison), but does not execute the b statement. Therefore, the value of b remains unchanged at 6, which is then printed to the console.
Explore Courses for Quant exam
What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer?
Question Description
What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? for Quant 2025 is part of Quant preparation. The Question and answers have been prepared according to the Quant exam syllabus. Information about What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? covers all topics & solutions for Quant 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer?.
Solutions for What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Quant. Download more important topics, notes, lectures and mock test series for Quant Exam by signing up for free.
Here you can find the meaning of What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer?, a detailed solution for What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? has been provided alongside types of What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the output of the following programmain(){int a=10;int b=6;if(a=3)b++;printf("%d %dn",a,b++);}a)10,6b)10,7c)3,6d)3,7e)noneCorrect answer is option 'D'. Can you explain this answer? tests, examples and also practice Quant tests.
Explore Courses for Quant exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev